package com.qf.flash.mvp.presenter;

import com.qf.flash.http.HttpManager;
import com.qf.flash.model.GameGroupBean;
import com.qf.flash.mvp.contract.GameContract;
import com.qf.flashlib.base.BasePresenter;
import com.qf.flashlib.base.BaseResponse;
import com.qf.flashlib.base.BaseSubscriber;
import com.qf.flashlib.util.RxUtils;

import java.util.List;

/**
 * 创建日期：2020/3/8 on 10:28
 * 描述:
 * 作者:戴旭东
 */
public class GameWaitePresenter extends BasePresenter<GameContract.View> implements GameContract.Presenter {
    @Override
    public void getGameList(String userId, String areaId,int page) {
        addSubscription(HttpManager.getInstance().getGsonHttpApi()
        .GAME_WAITE(userId, areaId, page)
                .compose(RxUtils.handleBaseResult())
                .compose(RxUtils.io_main())
                .subscribeWith(new BaseSubscriber<BaseResponse<List<GameGroupBean>>>(mRootView, false) {
                    @Override
                    public void onSuccess(BaseResponse<List<GameGroupBean>> game) {
                        mRootView.setGameList(game.getData(), game.getTotalPage());
                    }
                })
        );
    }

}
